<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
    <div class="row">
    	<div class="col-sm-12 search-collapse">
				<form id="empInfo-form">
					<div class="select-list">
						<ul>
							<li>
								姓名：<input type="text" name="empNm"/>
							</li>
							<li>
								证件号码：<input type="text" name="empId"/>
							</li>
							<li>
								公司名称：<input type="text" name="empComp"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
    
			<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="pm:empInfo:export" >
			            <i class="fa fa-download"></i> 导出
			    </a>
				<a class="btn btn-warning" onclick="refresh()">
					<i class="fa fa-download"></i> 刷新
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "pm/empInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "维护外包人员基本信息",
                uniqueId:"empId",
                search:false,
                showSearch:false,
                showColumns:false,
                showToggle:false,
                showExport:false,
                showRefresh:false,
                columns: [{
		            checkbox: true
		        },
		        {
					field : 'empNm', 
					title : '姓名'
				},
		        {
					field : 'empId', 
					title : '证件号码',
					visible: false
				},
				{
					field : 'empSex',
					title : '性别',
				},
				{
					field : 'verifyStatus',
					title : '审核状态',
				},
				{
					field : 'empComp',
					title : '公司名称'
				},
				{
					field : 'empEdu', 
					title : '学历'
				},
				{
					field : 'empDeg', 
					title : '学位',
					visible: false
				},
				{
					field : 'empSch', 
					title : '毕业院校' 
				},
				{
					field : 'empMajor',
					title : '专业名称'
				},
				{
					field : 'empMajorType', 
					title : '专业类别'
				},
				{
					field : 'empEnroDt', 
					title : '大学入学时间',
		            formatter: function(value, row, index) {
		            	var rowStr = "";
		            	if(!!row.empEnroDt)
		            		rowStr = '<span>'+row.empEnroDt.substr(0,10)+'</span>';
		            	return rowStr;
		            }  
				},
				{
					field : 'empGradDt', 
					title : '毕业时间',
		            formatter: function(value, row, index) {
		            	var rowStr = "";
		            	if(!!row.empEnroDt)
		            		rowStr = '<span>'+row.empGradDt.substr(0,10)+'</span>';
		            	return rowStr;
		            }  
				},
				{
					field : 'empTel', 
					title : '电话',
					visible: false 
				},
				{
					field : 'empWorkYears', 
					title : '工作年限'
				},
				{
					field : 'empBankYears', 
					title : '银行事项工作年限'
				},
				{
					field : 'empBankCount', 
					title : '银行事项个数'
				},
				{
					field : 'empCcbYears', 
					title : '建行事项工作年限'
				},
				{
					field : 'empCcbCount', 
					title : '建行事项个数'
				}
				]
            };
            $.table.init(options);
        });
        
     	// 导出维护外包人员表
        function expEmpInfo(){
			$.modal.loading("正在导出数据，请稍后...");
			$.post(prefix + "/expEmpInfo", $("#empInfo-form").serializeArray(), function(result) {
				if (result.code == web_status.SUCCESS) {
					// TODO
					alert("导出维护外包人员表成功");
				} else {
					$.modal.alertError(result.msg);
				}
				$.modal.closeLoading();
			});
        }

        //刷新
		function refresh() {
			var url = prefix + "/refresh";
			$.ajax({
				type: "post",
				url: url,
				data: "",
				contentType: "application/json;charset=UTF-8",
				success: function (data) {
					if (data.code === 0) {
						alert(data.msg);
						$.table.refresh();
					}
				}
			})
		}
    </script>
</body>
</html>